/**
 * 
 */
package com.keggview.application.datatypes;

import java.util.ArrayList;

/**
 * @author Pablo
 *
 */
public class Registry {
	public static ArrayList<Alt> alts;
	public static ArrayList<Component> components;
	public static ArrayList<Entry> entries;
	public static ArrayList<Graphics> grapics;
	public static ArrayList<Pathway> pathways;
	public static ArrayList<Product> products;
	public static ArrayList<Reaction> reactions;
	public static ArrayList<Relation> relations;
	public static ArrayList<Substrate> substrates;
	public static ArrayList<Subtype> subtypes;
	static {
		alts = new ArrayList<Alt>(0);
		components = new ArrayList<Component>(0);
		entries = new ArrayList<Entry>(0);
		grapics = new ArrayList<Graphics>(0);
		pathways = new ArrayList<Pathway>(0);
		products = new ArrayList<Product>(0);
		reactions = new ArrayList<Reaction>(0);
		relations = new ArrayList<Relation>(0);
		substrates = new ArrayList<Substrate>(0);
		subtypes = new ArrayList<Subtype>(0);
	}
	
	public static void register(Base object) {
		if (object instanceof Alt) {
			Alt new_name = (Alt) object;
			alts.add(new_name);			
		}
		
		if (object instanceof Component) {
			Component comp = (Component) object;
			components.add(comp);
		}
		
		if (object instanceof Entry) {
			Entry en = (Entry) object;
			entries.add(en);
		}
		
		if (object instanceof Graphics) {
			Graphics gra = (Graphics) object;
			grapics.add(gra);
		}
		
		if (object instanceof Pathway) {
			Pathway path = (Pathway) object;
			pathways.add(path);
		}
		
		if (object instanceof Product) {
			Product prod = (Product) object;
			products.add(prod);
		}
		
		if (object instanceof Reaction) {
			Reaction rea = (Reaction) object;
			reactions.add(rea);
		}
		
		if (object instanceof Relation) {
			Relation rel = (Relation) object;
			relations.add(rel);
		}
		
		if (object instanceof Substrate) {
			Substrate sub = (Substrate) object;
			substrates.add(sub);
		}
		
		if (object instanceof Subtype) {
			Subtype sub = (Subtype) object;
			subtypes.add(sub);
		}
	}
	
	public static ArrayList<Base> getAll() {
		ArrayList<Base> result = new ArrayList<Base>(0);
		result.addAll(Registry.alts);
		result.addAll(Registry.components);
		result.addAll(Registry.entries);
		result.addAll(Registry.grapics);
		result.addAll(Registry.pathways);
		result.addAll(Registry.reactions);
		result.addAll(Registry.relations);
		result.addAll(Registry.substrates);
		result.addAll(Registry.subtypes);
		return result;
	}

}
